package com.backpackerxl.blog.service.impl;

import com.backpackerxl.blog.dao.UserRepository;
import com.backpackerxl.blog.model.User;
import com.backpackerxl.blog.service.UserService;
import com.backpackerxl.blog.util.MD5Utils;
import org.springframework.stereotype.Service;

/**
 * Author by：Backpackersxl
 * Date: 2021/5/5/005
 * Time: 17:43
 **/
@Service
public class UserServiceImp implements UserService {
    private final UserRepository userRepository;

    public UserServiceImp(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @Override
    public User checkUser(String username, String password) {
        return userRepository.findByUsernameAndPassword(username, MD5Utils.code(password));
    }
}
